package com.ruoyi.system.service.impl;

import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.client.HSClient;
import com.ruoyi.common.constant.HuaSuConstant;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.domain.vo.huimin.CinemaOutVo;
import com.ruoyi.system.dto.film.FilmManagmentDto;
import com.ruoyi.system.service.IFilmManagementService;
import com.ruoyi.utils.ReflectionUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @ClassName FilmManagementServiceImpl
 * @Author YangFu
 * @Date 2024/3/17 20:02
 * @Version 1.0
 */
@Service
@RequiredArgsConstructor
public class FilmManagementServiceImpl implements IFilmManagementService {

    private final HSClient hsClient;

    @Override
    public List<CinemaOutVo> management(FilmManagmentDto dto,String token) {
        String s = ReflectionUtil.convertEntityToQueryString(dto);
        String cinemaPrefix = HuaSuConstant.CINEMA_PREFIX;
        R request = hsClient.getRequest(cinemaPrefix, s, CinemaOutVo.class,token);
        Object data = request.getData();
        String json = JSON.toJSONString(data);
        return JSON.parseArray(json,CinemaOutVo.class);
    }
}
